﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工程建设管理系统</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link href="/Content/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="/Content/layui-2.1.2/css/layui.css" />
    <link href="/Content/login.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.10.2.min.js"></script>
    <script src="/Scripts/bootstrap.js"></script>
    <script src="/Content/layui-2.1.2/layui.js"></script>
    <script src="/Content/layui-2.1.2/lay/modules/layer.js"></script>
    <script src="/Content/layui-2.1.2/lay/modules/form.js"></script>
    <!-- 此段必须要引入 t为小时级别的时间戳 -->
    @*<link type="text/css" href="//g.alicdn.com/sd/ncpc/nc.css?t=1502935563367" rel="stylesheet" />
        <script type="text/javascript" src="//g.alicdn.com/sd/ncpc/nc.js?t=1502935563367"></script>*@
    <!-- 引入结束 -->
</head>
<!--[if lt IE 9]>
<script src="/Scripts/html5shiv.min.js"></script>
<script src="/Scripts/respond.min.js"></script>
    <![endif]-->
<body onkeydown="KeyDown();">
    <!-- 此段必须要引入 -->
    <div id="_umfp" style="display:inline;width:1px;height:1px;overflow:hidden"></div>

    <header class="header">
        <!--src=""-->
        <img src="~/Images/login-logo.jpg" alt="Alternate Text" class="login-logo"/>
    </header>
    <div class="login-wrap">
        <form action="" method="post" name="formlogin">
            <div class="login-box">
                <span class="login-tittle">系统登录</span>
                <hr class="login-line" />
                <div class="username-box input-box">
                    <i class="glyphicon glyphicon-user" style="color:#4297f1"></i>
                    <input type="text" name="username" id="userName" placeholder="用户名" value="@ViewBag.userName"/>
                </div>
                <div class="password-box input-box">
                    <i class="glyphicon glyphicon-lock" style="color:#4297f1"></i>
                    <input type="password" name="password" id="password" placeholder="密码" value="@ViewBag.password"/>
                </div>
                <div class="password-box input-box" style="width: 165px;margin-left: 2px;">
                    <i class="glyphicon glyphicon-lock" style="color:#4297f1"></i>
                    <input type="text" name="verifyCode" id="verifyCode" placeholder="验证码" style="width:120px;" />
                    <img id="verifyCodeImg" class="verify-code" style="height: 43px;margin-top: -61px;margin-left: 155px;" src="@Url.Action("ValidateCode")" />
                </div>
                <span class="caution"></span>
                <div class="auto-box layui-form ">
                    <input type="checkbox" name="autologin" lay-skin="primary" value="true" @(ViewBag.autoLogin == true ? Html.Raw("checked='checked'") : Html.Raw("")) />&nbsp;&nbsp;7天内自动登录
                    <span class="forget-pwd"><a href="@ViewBag.ForgetPwdUrl" target="_blank">忘记密码</a></span>
                </div>
                <input type="button" value="登     录" id="btnSub" name="btnSub" class="login-btn">
                <hr class="login-line" />
            </div>
        </form>
    </div>
    <footer class="footer">
        <span class="copy-right">中国石油陕西销售分公司</span>
        备案号:<a href="http://www.beian.miit.gov.cn/state/outPortal/loginPortal.action;jsessionid=GWyFUHbkdNjtDXEKe49_HaO5Sjnp-tCie31LTy3ZUkZPd31pXFBI!20875049">
            陕ICP备09010992号-4
        </a>
    </footer>
</body>
</html>

<script>
    $(document).ready(function () {
        $('#verifyCodeImg').click(function () {
            this.src = "@Url.Action("ValidateCode")?ts=" + Math.random().toString();
        });
    });
    layui.use(['layer', 'form', 'element'], function () {
        var layer = layui.layer, form = layui.form, element = layui.element;
    });
    //var nc = new noCaptcha();
    //var nc_appkey = 'FFFF00000000017C1E00';  // 应用标识,不可更改
    //var nc_scene = 'login';  //场景,不可更改
    //var nc_token = [nc_appkey, (new Date()).getTime(), Math.random()].join(':');
    //var nc_option = {
    //    renderTo: '#verify-code',//渲染到该DOM ID指定的Div位置
    //    appkey: nc_appkey,
    //    scene: nc_scene,
    //    token: nc_token,
    //    //trans: '{"name1":"code200"}',//测试用，特殊nc_appkey时才生效，正式上线时请务必要删除；code0:通过;code100:点击验证码;code200:图形验证码;code300:恶意请求拦截处理
    //    callback: function (data) {// 校验成功回调
    //        document.getElementById('csessionid').value = data.csessionid;
    //        document.getElementById('sig').value = data.sig;
    //        document.getElementById('token').value = nc_token;
    //        document.getElementById('scene').value = nc_scene;
    //    }
    //};
    //nc.init(nc_option);
    $("#btnSub").click(function () {
        var form = $("form").serialize();
        $.post("Login", form, function (data) {
            if (data.Flag) {
                $(".caution").text(data.Message);
                location.href = "/Home/Index";
            } else {
                $('#verifyCodeImg').click();
                $(".caution").text(data.Message);
                //nc.init(nc_option);
            }
        });
    });
    //回车键自动登录
    function KeyDown() {
        if (event.keyCode == 13) {
            event.returnValue = false;
            event.cancel = true;
            formlogin.btnSub.click();
        }
    }
</script>


